< previous page page_121 next page >

Page 121
declare them Public. Keep in mind, also, that using this programming tactic introduces a level of complexity in that clients of the subsystem are exposed to more internal details than with the broker approach. This will add to the maintenance of the application as it evolves in the future. However, this approach is ideal for your object repositories in those situations in which clients will know about the interfaces anyway.
Finally, subsystems can be implemented as COM/DCOM or CORBA components. Components contain one to many objects that together provide a set of related services to the component's clients via interfaces. You can have components that interact with other components locally on the same machine or remotely on different machines. If you deploy components remotely, you are entering the realm of distributed computing, which is full of complexity.
Note
CORBA is an acronym for Common Object Request Broker Architecture. COM/DCOM stands for Component Object Model/Distributed Component Object Model.

Whether you're deploying components locally or remotely, every interface requires a separate, distinct interface ID. In the earlier example, given the following declarations:
Public theInterestBearingChecking As New _ InterestBearingChecking

Public theSavings As New Savings
both the InterestBearingChecking and theSavings would have to have published interface IDs. In COM/DCOM, each interface's version is given a globally unique identifier (GUID). The CORBA equivalent of GUID is the universally unique identifier (UUID).
COM has many interfaces beyond the scope of this book to describe. However, one COM interface must be noted. When implementing a COM component in Visual Basic, the interfaces inside implement COM's IUnknown interface. IUnknown's main responsibilities include runtime type checking and enforcement as well as interface reference counting. IUnknown publishes three methodsAddRef(), Release(), and QueryInterface()that, together, make this interface class similar to the ObjectFactory sample class earlier. AddRef() is invoked when a class instance is created, and Release() is invoked to destroy the same class instance. QueryInterface() is seamlessly invoked to obtain a specific interface pointer using an interface pointer identifier. Although, as a Visual Basic developer, you won't have to worry about IUnknown, it's good to know what goes on under the hood as a starting point for investigating object reference flaws.

 
< previous page page_121 next page >

If you like this book, buy it!